package pl.koszolko.documentclustering.dao.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DataBaseUtils {

	public static synchronized Long getNextValFromSeq(Connection conn, String sql) throws SQLException {
		Long nextVal = null;
		
		PreparedStatement ps = conn.prepareStatement(sql);
		ResultSet rs = ps.executeQuery();
		while(rs.next())
			nextVal = rs.getLong(1);
		
		return nextVal;
	}	
}
